box.ctl.on_recovery_state()
- 
 box.ctl.on_recovery_state(trigger-function)¶
- Since: 2.11.0 - Create a trigger executed on different stages of a node recovery or initial configuration. Note that you need to set the - box.ctl.on_recovery_statetrigger before the initial box.cfg call.- Параметры: - trigger-function (function) – a trigger function
 - Return: - nilor a function pointer- A registered trigger function is run on each of the supported recovery state and receives the state name as a parameter: - snapshot_recovered: the node has recovered the snapshot files.
- wal_recovered: the node has recovered the WAL files.
- indexes_built: the node has built secondary indexes for memtx spaces. This stage might come before any actual data is recovered. This means that the indexes are available right after the first tuple is recovered.
- synced: the node has synced with enough remote peers. This means that the node changes the state from orphan to- running.
 - All these states are passed during the initial - box.cfgcall when recovering from the snapshot and WAL files. Note that the- syncedstate might be reached after the initial- box.cfgcall finishes. For example, if replication_sync_timeout is set to 0, the node finishes- box.cfgwithout reaching- syncedand stays- orphan. Once the node is synced with enough remote peers, the- syncedstate is reached.- Примечание - When bootstrapping a fresh cluster with no data, all the instances in this cluster execute triggers on the same stages for consistency. For example, - snapshot_recoveredand- wal_recoveredrun when the node finishes a cluster’s bootstrap or finishes joining to an existing cluster.- Example: - The example below shows how to log a specified message when each state is reached. - local log = require('log') local log_recovery_state = function(state) log.info(state .. ' state reached') end box.ctl.on_recovery_state(log_recovery_state) 
- trigger-function (